import request from "@/api";

export default class ResourceApi {
  /**
   * 查询
   * @returns
   */
  static async query(): Promise<ServerResourceModel> {
    return await request({
      url: "/serverResource/query",
      method: "get",
    });
  }
}

export interface ServerResourceModel {
  time?: string;
  sys?: Sys;
  cpu?: Cpu;
  memory?: Memory;
  swap?: Swap;
  disk?: Disk;
}

export interface Sys {
  os?: string;
  day?: string;
  ip?: string;
}

export interface Cpu {
  name?: string;
  package?: string;
  core?: string;
  coreNumber?: number;
  logic?: string;
  used?: number;
  idle?: number;
}

export interface Memory {
  total?: string;
  available?: string;
  used?: string;
  usageRate?: number;
}

export interface Swap {
  total?: string;
  available?: string;
  used?: string;
  usageRate?: number;
}

export interface Disk {
  total?: string;
  available?: string;
  used?: string;
  usageRate?: number;
}
